package com.cobra.rdd.operator.transform

import org.apache.spark.{SparkConf, SparkContext}

//获取每个分区的最大值
object Spark06_RDD_Operator_Transform_flat_map1 {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("mapPartitionsWithIndex")
    val sc = new SparkContext(sparkConf)
    val rdd = sc.makeRDD(List("Hello Scala","Hello Spark"))
    val flatRDD = rdd.flatMap(
      s => {
        s.split(" ")
      }
    )
    flatRDD.collect().foreach(println)
    sc.stop()
  }
}
